package com.example.mobile2021606127cxz0415homework;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity extends AppCompatActivity {

    private RecyclerView rvMainSchool;
    private String [] schoolnames={"广东职业技术学院","佛山职业技术学院","深圳职业技术学院","番禺职业技术学院","东莞职业技术学院","珠海职业技术学院","河源职业技术学院","惠州职业技术学院","梅州职业技术学院","清远职业技术学院"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();

        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        rvMainSchool.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
        rvMainSchool.setLayoutManager(linearLayoutManager);
        SchoolAdapter adapter=new SchoolAdapter(schoolnames);
        rvMainSchool.setAdapter(adapter);
    }

    private void initView() {
        rvMainSchool = (RecyclerView) findViewById(R.id.rv_main_school);
    }
}